home *** CD-ROM | disk | FTP | other *** search
- Path: s3.phxslip4.indirect.com!pronet01
- From: pronet01@indirect.com (Mark Miller)
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Performance: C vs. C++
- Date: Sat, 3 Feb 1996 21:04:09 UNDEFINED
- Organization: Promark One
- Message-ID: <pronet01.31.003EB1E6@indirect.com>
- References: <30F6BAAC.12B5@iastate.edu> <4da9pn$a45@news.bridge.net> <4dnpl2$c8g@classic.iinet.com.au> <3105E9DC.1BE3@enermet.fi> <DLr46y.7rH@txnews.amd.com> <4elk5l$3f2q@yuma.ACNS.ColoState.EDU>
- NNTP-Posting-Host: s3.phxslip4.indirect.com
- X-Newsreader: Trumpet for Windows [Version 1.0 Rev B final beta #1]
-
- In article <4elk5l$3f2q@yuma.ACNS.ColoState.EDU> steffend@lamar.colostate.edu (Dave Steffen) writes:
- >From: steffend@lamar.colostate.edu (Dave Steffen)
- >Subject: Re: Performance: C vs. C++
- >Date: 30 Jan 1996 17:23:01 GMT
-
- >Bret Patterson (faustus) wrote: (in part)
-
- >> The only thing of C++ that I know causes alot of overhead is
- >> exceptions. But other forms of error checking are available and
- >> exceptions can also be optimized/minimized.
-
- > I believe that exceptions only produce overhead _if_ an
- >exception is thrown; otherwise, there shouldn't be _any_ overhead.
-
- > At least, this is what Stoustrup says _should_ be the
- >case. Whether or not your compiler is up to the task is another
- >matter. ;-)
-
- > /\
- > \/
-
- >Dave Steffen No, his mind is not for rent
- >Dept. of Physics To any God or Government
- >Colorado State University Always hopeful, yet discontent
- >steffend@lamar.colostate edu He knows changes aren't permanent-
- > But change is...
- >"Speak softly...
- >... and carry a black belt!" -Neal Peart / RUSH
- >-----------------------------------------------------------------------
-
- On the subject of performance, it irks me a little when I hear people say
- that they don't use C++ because it's "ALOT" slower than C when, in fact,
- (usually just with older compilers) you lose only about 5% and most often
- 0-5% (when you can upgrade your CPU). To me (I can see the flame mail
- coming), I'd rather have a truely designed/implemented OO System (taking
- advantage of the OO features, identity/encapsulation/polymorphism-inheritant
- features) which will be a heck of alot more maintainable and less costly
- in the long run and spend about $1000 or less on a hardware boost...
-
- 2 people told me in the past that C++ sucked because it was too slow and
- when I looked at their programs, I noticed that they did not pass by reference
- to methods (which always invokes constructors and destructors in addition
- to stack operations), and that they ended up calling member functions inside of
- for-loops;
-
- for (int i = 0; i < object.size(); i++)
- without realizing 'object.size()' kept getting called during each iteration..
-
- and little stuff like that... Also, with proper use of 'inlining' with the
- above techniques, there's no reason why a C++ system cannot run
- just as fast (maybe with milliseconds of difference when performing
- run-time identification) as a system written in C. And look at the benefits
- you will get with an OO system...
-
- theron kousek
-
-
-